﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace Silvery.Role.Simple
{
    /// <summary>
    /// 名字板
    /// </summary>
    public class NamePanel : BaseObject
    {
        public const double NamePanelWidth = 120;
        public const double NamePanelHeight = 16;
        private TextBlock _RoleName = new TextBlock() { Text = "",Width = NamePanelWidth, FontSize = 14, Foreground = new SolidColorBrush(Color.FromArgb(255, 210, 12, 12)), TextAlignment = TextAlignment.Center, FontFamily = new FontFamily("Arial,SimHei") };
        internal TextBlock _RoleNamesandow = new TextBlock() { Text = "", Width = NamePanelWidth, FontSize = 14, Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)),TextAlignment = TextAlignment.Center, FontFamily = new FontFamily("Arial,SimHei") };
        public NamePanel()
        {
            this.Children.Add(_RoleNamesandow);
            this.Children.Add(_RoleName);
            
            Canvas.SetLeft(_RoleNamesandow, 3);
            Canvas.SetTop(_RoleNamesandow, 3);
            base.Position = new Point(-NamePanelWidth / 2, NamePanelHeight);
        }
        public NamePanel(string defname)
        {
            RoleName.Text = defname;
            _RoleNamesandow.Text = defname;
            this.Children.Add(_RoleNamesandow);
            this.Children.Add(_RoleName);

            Canvas.SetLeft(_RoleNamesandow, 1);
            Canvas.SetTop(_RoleNamesandow, 1);
            base.Position = new Point(-NamePanelWidth / 2, NamePanelHeight);
        }
        public TextBlock RoleName
        {
            get { return _RoleName; }
        }
    }
}
